package compiler;
import java.util.ArrayList;

public class LineParser {
	private static ArrayList<String> components = null;	
	
	public static ArrayList<String> parseLine(String line)
	{
		components=new ArrayList<String>();
		int oldIndex=0;
		int newIndex=0;
		for(int i=0; i<line.length();i++)
		{
			if (line.charAt(i)== ' ') 
			{	newIndex=i;
				if (Math.abs(oldIndex-newIndex)>0)components.add(line.substring(oldIndex, newIndex));
				while(i<line.length() && line.charAt(i)==' ') i++;
				oldIndex=i;
			}
		}
		if (oldIndex<line.length()) components.add(line.substring(oldIndex, line.length()));
		return components;
	}
	
		public static void main(String[] args)
	{
		String test=new String("(x,y)");
		ArrayList<String> list=LineParser.parseLine(test);
		for(int i=0; i<list.size();i++)
		{
			System.out.println(list.get(i)+"X");
		}
		
		Libraries.loadAll();
		System.out.println(Libraries.getActionLibrary().get(1)+ " " +Libraries.getActionLibrary().get(2));
		
	}
}
